﻿namespace Sgr.Domain.Uow
{
    /// <summary>
    /// 工作单元跟踪器接口
    /// </summary>
    public interface IUnitOfWorkTracker
    {
        /// <summary>
        /// 获取当前工作单元
        /// </summary>
        IUnitOfWork? Current { get; }

        /// <summary>
        /// 检查并获取当前工作单元
        /// </summary>
        /// <returns>当前工作单元</returns>
        IUnitOfWork? GetCurrentByChecking();

        /// <summary>
        /// 设置当前工作单元
        /// </summary>
        /// <param name="unitOfWork">工作单元实例</param>
        void SetUnitOfWork(IUnitOfWork? unitOfWork);

        /// <summary>
        /// 清理当前工作单元
        /// </summary>
        /// <param name="unitOfWork">工作单元实例</param>
        void ClearCurrent(IUnitOfWork unitOfWork);
    }
}